package br.com.viamais.business.bean;

import br.com.viamais.business.IRoleBO;
import br.com.viamais.dao.RoleDAO;
import br.com.viamais.enumerator.Permission;
import br.com.viamais.model.Role;

/**
 * DAO to Role class.
 * 
 * TODO: logger.
 * TODO: Custom exception.
 * 
 * @author Eduardo
 */
public class RoleBO implements IRoleBO {
	/**
	 * Serial version ID.
	 */
	private static final long serialVersionUID = 6314192101871132132L;
	/**
	 * Role DAO.
	 */
	private RoleDAO roleDAO;
	/**
	 * Constructor
	 */
	public RoleBO() {
		super();
		roleDAO =  new RoleDAO();
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public Role getByPermission(Permission permission) throws Throwable {
		return roleDAO.getByPermission(permission);
	}

	/**
	 * {@inheritDoc}
	 * @return 
	 */
	@Override
	public void saveOrUpdate(Role role) throws Throwable {
		roleDAO.saveOrUpdate(role);
	}

}
